<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>Debugging Custom Actions</title>

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="expires" content="" />
<meta name="lang" content="en-US" />
<meta name="template-info" content="topic.htm 2012-03-19 usp" />
<meta name="creation-date" scheme="iso8601" content="2013-06-25" />
<meta name="last-modified" scheme="iso8601" content="2013-06-28" />
<meta name="publication-date" scheme="iso8601" content="" />
<meta name="version" content="2" />
<meta name="author" content="USP" />
<meta name="robots" content="follow" />
<meta name="category" content="Programming/Deployment" />
<meta name="keywords" content="programming, deployment, setup, debugging." />
<meta name="description" content="A note on debugging custom actions." />

<link rel="stylesheet" type="text/css" href="../../../includes/topic-2.css" />
<link rel="stylesheet" type="text/css" href="../local.css" />

<script language="JavaScript" type="text/javascript" src="../../../includes/global.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../includes/cookies.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../includes/topic.js"></script>
<script language="JavaScript" type="text/javascript" src="../local.js"></script>

</head><body class="content" onload="onloadTopic()"><a name="top"></a>

<h1>Debugging Custom Actions</h1>

<p>You cannot easily debug a custom action DLL - a library project cannot be startet directly, and a setup and deployment project cannot be debugged. Or can it?</p>

<p>Fortunately, we can navigate around this obstacle:</p>

<ol>
<li>Insert a System.Diagnostics.Debugger.Launch() statement in your custom action code.</li>
<li>Set a breakpoint on the statement below that.</li>
<li>If you like, put conditional compile statements around: #if DEBUG...#endif</li>
<li>Run VS as administrator (Start, Run as...).</li>
<li>Run the installer from inside VS.</li>
<li>The Launch statement fires a Jit debugger selector dialog.</li>
<li>Select the VS instance already running.</li>
<li>Click the debug language types <a href="../img/fig-021.png" onclick="function openImageWindow( event, imageViewer, 200, 200 )
">selector dialog</a>, deselect "Native code" (this option enabled slows down the loading process to about 5 minutes!)</li>
<li>Be patient.</li>
<li>Wait.</li>
<li>Get a cup of coffee.</li>
<li>Check the weather conditions.</li>
<li>Watch assemblies being loaded slowly in the VS output window.</li>
<li>Order pizza for diner.</li>
<li>Eventually, find your devenv working again.</li>
<li>Debug you code, find the bugs, and be happy.</li>
</ol>

<p>So what's going on here? I'm not really sure, but i guess it's the f***ing security software running on my machine that monitors the system and intercepts some critical calls. After all, installations are system critical, aren't they? So that's ok as far as I am concerned. But why for god's sake, why does it take THAT long...?</p>

<div class="footer"><hr />
<p>Page author: USP &bull; Page editor: USP &bull; Last update: 2013-06-28 &bull; 3</p>
<p>&copy; 2013 Synesis Ulrich Sprick. All rights reserved. See <a href="../../../copyright.htm">Copyright details</a>.</p>
<p><a href="#top">Back to Top</a> | <a href="../../../index.htm" target="_top">Home</a> | <a id="reload" onclick="reloadFrameset()" href ="../../../index.htm" target="_top" >Reload Frameset</a></p>
</div></body></html>
